import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    cipherList = '/cipher/list',
    cipherCreate = '/cipher/create',
    cipherDelete = '/cipher/delete',
    cipherUpdate = '/cipher/update',
    cipherInTemp = '/cipher/intemp',
    cipherUpDateTemp = '/cipher/updatetemp'
}

/**
 * @description: 修改
 */
export function cipherUpdate(params: any) {
    return http.request({
        url: Api.cipherUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function cipherDelete(params: any,option: any) {
    return http.request({
        url: Api.cipherDelete,
        method: 'POST',
        params,
    },{
        ...option,
        isTransformRequestResult: false,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function cipherCreate(params: any) {
    return http.request({
        url: Api.cipherCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function cipherList(params: any) {
    return http.request({
        url: Api.cipherList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}

export function cipherInTemp(tempid: number){
    return http.request({
        url:Api.cipherInTemp,
        method: "POST",
        params:{'tempid':tempid},
    })
}

export function cipherUpdateTemp(params: any){
    return http.request({
        url:Api.cipherUpDateTemp,
        method: "POST",
        params,
    })
}
